package org.foj.model {
import mx.messaging.ChannelSet;
import mx.messaging.channels.AMFChannel;
import mx.messaging.channels.StreamingAMFChannel;

public class ChannelSetFactory {

  private static var _defaultChannelSet:ChannelSet;
  private static var _messagingChannelSet:ChannelSet;

  public function ChannelSetFactory() {
  }

  public static function getDefaultChannel():ChannelSet {
    if (_defaultChannelSet == null) {
      var channel:AMFChannel = new AMFChannel("my-amf",
          "http://localhost:8080/flexbugs/messagebroker/amf");
      _defaultChannelSet = new ChannelSet();
      _defaultChannelSet.addChannel(channel);
    }

    return _defaultChannelSet;
  }

  public static function getMessagingChannel():ChannelSet {
    if (_messagingChannelSet == null) {
      var pollingChannel:AMFChannel = new AMFChannel("my-polling-amf",
          "http://localhost:8080/flexbugs/messagebroker/amfpolling");
      _messagingChannelSet = new ChannelSet();
      _messagingChannelSet.addChannel(pollingChannel);
    }

    return _messagingChannelSet;
  }

}
}

